package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.admin.WorkspaceService;
import com.sky.vo.BusinessDataVO;
import com.sky.vo.DishOverViewVO;
import com.sky.vo.OrderOverViewVO;
import com.sky.vo.SetmealOverViewVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDate;

@RestController
@RequestMapping("/admin/workspace")
public class WorkspaceController {
    @Resource
    private WorkspaceService workspaceService;
    /**
     * 今日数据的接口设计
     * */
    @GetMapping("/businessData")
    public Result<BusinessDataVO> getBusinessDate(){
        //获得当天的开始时间
        LocalDate begin = LocalDate.now();
        //获得当天的结束时间
        LocalDate end = LocalDate.now();
        BusinessDataVO businessDataVO=workspaceService.getBusinessDate(begin,end);
        return Result.success(businessDataVO);
    }
    /**
     * 查询订单管理数据
     * */
    @GetMapping("/overviewOrders")
    public Result<OrderOverViewVO> overviewOrder(){
        OrderOverViewVO orderOverViewVO=workspaceService.overviewOrder();
        return Result.success(orderOverViewVO);
    }
    /**
     * 菜品总览的接口设计
     * */
    @GetMapping("/overviewDishes")
    public Result<DishOverViewVO> dishOverView(){
        DishOverViewVO dishOverViewVO=workspaceService.overviewDishes();
        return Result.success(dishOverViewVO);
    }
    /**
     * 查询套餐总览
     * */
    @GetMapping("/overviewSetmeals")
    public Result<SetmealOverViewVO> setmealOverView(){
        SetmealOverViewVO setmealOverViewVO=workspaceService.setmealOverView();
        return Result.success(setmealOverViewVO);
    }
}
